//
//  StarEffect.m
//  UnderTheSea
//
//  Created by Thi Huynh on 4/18/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "StarEffect.h"

@implementation StarEffect
-(id) init
{
	return [self initWithTotalParticles:20];
}

-(id)initStarWith:(CGPoint)position
{
    if( (self=[super initWithTotalParticles:1000]) ) 
    {
        [self resetSystem];
		// duration
		duration = 2.6f;
		
		self.emitterMode = kCCParticleModeGravity;
        
		// Gravity Mode: gravity
		self.gravity = ccp(0,0);
		
		// Gravity Mode: speed of particles
		self.speed = 150;
		self.speedVar = 200;
		
		// Gravity Mode: radial
		self.radialAccel = 0;
		self.radialAccelVar = 0;
		
		// Gravity Mode: tagential
		self.tangentialAccel = 0;
		self.tangentialAccelVar = 0;
		
		// angle
		angle = 90;
		angleVar = 90;
        
		// emitter position
		self.position = ccp(position.x, position.y);
        
		posVar = CGPointZero;
		
		// life of particles
		life = 1;
		lifeVar = 0.3;
		
		// size, in pixels
		startSize = 30;
		startSizeVar = 20;
        
		endSize = 5;
        
		// emits per second
		emissionRate = totalParticles;///duration;
		
		// color of particles
		startColor.r = 255;
		startColor.g = 255;
		startColor.b = 255;
		startColor.a = 1;
        
        self.texture = [[CCTextureCache sharedTextureCache] addImage:IMG_OBJECT_SMALL_BOMB];
        
		// additive
		self.blendAdditive = YES;
	}
	
	return self;
    
}

@end
